package com.block.datapush.service.apipush.utils;

import cn.hutool.core.util.StrUtil;
import com.block.common.enums.BaseTypeInfoEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 橙易通 APIB回调
 */
public class RongXinYongCaiApiBUtil {

    //芝麻
    public static Integer getZhima(String zhima) {
        if (StrUtil.equals(zhima, BaseTypeInfoEnum.Zhima.zm001.getValue())){
            return 1;
        } else if (StrUtil.equals(zhima, BaseTypeInfoEnum.Zhima.zm002.getValue())) {
            return 2;
        } else if (StrUtil.equals(zhima, BaseTypeInfoEnum.Zhima.zm003.getValue())) {
            return 3;
        }else if (StrUtil.equals(zhima, BaseTypeInfoEnum.Zhima.zm004.getValue())) {
            return 4;
        }
        return 5;
    }

    //公积金
    public static Integer getFund(String fund) {
        if (StrUtil.equals(fund, BaseTypeInfoEnum.Gjj.gjj001.getValue())) {
            return 1;
        } else if (StrUtil.equals(fund, BaseTypeInfoEnum.Gjj.gjj002.getValue())) {
            return 2;
        }
        return 3;
    }

    //社保
    public static Integer getShebao(String shebao) {
        if (StrUtil.equals(shebao, BaseTypeInfoEnum.Shebao.sb001.getValue())) {
            return 1;
        } else if (StrUtil.equals(shebao, BaseTypeInfoEnum.Shebao.sb002.getValue())) {
            return 2;
        }
        return 3;
    }

    //保单
    public static Integer getBaodan(String baoxian) {
        if (StrUtil.equals(baoxian, BaseTypeInfoEnum.Baoxian.bx001.getValue())) {
            return 2;
        } else if (StrUtil.equals(baoxian, BaseTypeInfoEnum.Baoxian.bx002.getValue())) {
            return 1;
        }
        return 3;
    }

    //房产
    public static Integer getHouse(String house) {
        if (StrUtil.equals(house, BaseTypeInfoEnum.House.hu001.getValue())) {
            return 1;
        }else if (StrUtil.equals(house, BaseTypeInfoEnum.House.hu002.getValue()) || StrUtil.equals(house, BaseTypeInfoEnum.House.hu003.getValue())) {
            return 3;
        }
        return 2;
    }

    //车产
    public static Integer getCar(String car) {
        if (StrUtil.equals(car, BaseTypeInfoEnum.Car.car001.getValue())) {
            return 3;
        }else if (StrUtil.equals(car, BaseTypeInfoEnum.Car.car003.getValue())) {
            return 2;
        }
        return 1;
    }

    //贷款金额
    public static String getloan(String loan) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la001.getValue(), loan)) {
            return "10000";
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la002.getValue(), loan)) {
            return "30000";
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la003.getValue(), loan)) {
            return "50000";
        }
        return "100000";
    }

    //职业身份
    public static String getJob(String jbo) {
        if (StrUtil.equals(jbo, BaseTypeInfoEnum.Gongzuo.gz001.getValue())) {
            return "1";
        } else if (StrUtil.equals(jbo, BaseTypeInfoEnum.Gongzuo.gz002.getValue())) {
            return "3";
        } else if (StrUtil.equals(jbo, BaseTypeInfoEnum.Gongzuo.gz004.getValue())) {
            return "2";
        }
        return "5";
    }

    public static String getReqIp(String ip) {
        if (StringUtils.isNotEmpty(ip)) {
            return ip;
        }
        return "127.0.0.1";
    }































}
